<html>

<head>
    <meta charset="UTF-8">
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta name="format-detection" content="telephone=no">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">

    <script src="../../assets/js/jquery-3.4.1.min.js"></script>
    <script src="../../assets/js/constants.js"></script>
    <script src="../../assets/js/bootstrap.min.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/vue"></script>
    <script src="../../assets/js/layer.js"></script>


    <link rel="stylesheet" href="../../assets/css/bootstrap.min.css" id="layuicss-layer">

    <title>商户登录</title>

    <style>
        .error-warp {
            width: 100%;
            height: 100%;
            background: url("https://yanlight-trade.oss-cn-zhangjiakou.aliyuncs.com/images/bg/905157422f484f39b42ec79fe9797d8b.jpeg") no-repeat 0 0;
            background-size: cover;
            text-align: center;
            padding-top: 100px
        }

        .error-warp .text {
            font-size: 22px;
            color: black;
        }

        .login-warp {
            width: 100%;
            height: 100%;
            background: url("https://yanlight-trade.oss-cn-zhangjiakou.aliyuncs.com/images/bg/905157422f484f39b42ec79fe9797d8b.jpeg") no-repeat 0 0;
            background-size: cover;
        }

        .login-warp .company-info {
            text-align: center;
        }

        .login-warp .company-info .avatar {
            width: 90px;
            height: 90px;
            margin-top: 45px;
            margin-bottom: 15px;
        }

        .login-warp .form-container {
            margin-left: 35px;
            margin-right: 35px;
            margin-top: 25px;
        }

        .login-warp .form-container .item {
            width: 100%;
            height: 45px;
        }

        .desc {
            font-size: 22px;
            color: black;
        }
    </style>
</head>

<body>
    <div class="error-warp" style="display: none">
        <span class="text">请在微信浏览器中打开</span>
    </div>

    <div class="login-warp" style="display: none">
        <div class="company-info">
            <img class="avatar"
                src="https://yanlight-trade.oss-cn-zhangjiakou.aliyuncs.com/images/avatar/366e3a83461c49458768de1ef17a66a9.png" />
            <div>
                <span class="desc">微食刻商户登录</span>
            </div>
        </div>

        <div class="form-container">
            <div class="form-group input-group-lg item">
                <input type="text" class="form-control" id="exampleInputEmail1" placeholder="请输入您的账号" v-model="account">
            </div>
            <div class="form-group input-group-lg item">
                <input type="password" class="form-control" id="exampleInputPassword1" placeholder="请输入您的密码"
                    v-model="password">
            </div>

            <button v-on:click="requestLogin()" class="btn btn-primary item">登录</button>
        </div>
    </div>

    <script>

        // var isInWx = isInWerXin();
        var isInWx = true;

        if (isInWx) {
            $(".login-warp").show();

            var vue = new Vue({
                el: '.login-warp',
                data: {
                    account: "life_artist@163.com",
                    password: "123456"
                },
                methods: {
                    requestLogin: function () {
                        if (vue.account == null || vue.account == "") {
                            vue.messageAlert("请输入您的账号")
                            return;
                        }
                        if (vue.password == null || vue.password == "") {
                            vue.messageAlert("请输入您的密码")
                            return;
                        }

                        var requestUrl = getManageHostName() + "user/login"
                        // showCommonLoading()

                        window.location.href = "preview.html"
                        // $.ajax({
                        //     url: requestUrl,
                        //     type: 'POST',
                        //     contentType: "application/x-www-form-urlencoded;charset=UTF-8",
                        //     dataType: "json",
                        //     data: {
                        //         userName: vue.account,
                        //         password: vue.password,
                        //         needVerify: false
                        //     },
                        //     success: function (result) {
                        //         hiddenCommonLoading()
                        //         console.log(result)
                        //         if (result.errorCode == 0) {
                        //             window.location.href = "preview.html"
                        //         } else {
                        //             vue.messageAlert(result.errorMsg)
                        //         }
                        //     },
                        //     error: function (error) {
                        //         hiddenCommonLoading()
                        //         vue.messageAlert("系统异常")
                        //     }
                        // })

                    },
                    messageAlert: function (msg) {
                        var alert = layer.alert(msg, {
                            skin: 'layui-layer-lan',
                            title: '提示',
                            closeBtn: 0
                        }, function () {
                            layer.close(alert)
                        });
                    }
                },
            })
        } else {
            $(".error-warp").show();
        }
    </script>
</body>

</html>